package day05;
public class MaxOfaArray {
    public static void main(String[] args) {
        int[] arr = new int[10];
        for (int i=1;i<arr.length;i++){
            arr[i] = (int)(Math.random()*100);
            System.out.println(arr[i]);
        }
        //假设
        int max = arr[0];//假设第1个元素为最大值
        for (int i=1;i<arr.length;i++){//遍历剩余元素
            if (arr[i]>max){//若剩余元素大于max
                max = arr[i];//将max修改为较大的
            }
        }
        System.out.println("最大值为:"+max);

        int[] arr1 = new int[10];
        for (int i=1;i<arr1.length;i++){
            arr1[i] = (int)(Math.random()*100);
            System.out.println(arr1[i]);
        }

    }
}
